package com.neusoft.rental.mapper;

import com.neusoft.rental.po.Placeappointment;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PlaceappointmentMapper {

    //sql语句请看mapper文件夹中xml文件
    //两个功能，功能一，根据judge判断审核进行状态，查询对应管理员应该处理的预约信息
    //二是传placeid，查询对应场地的所有已被审核通过的场地预约，用于展示已被预约时间和判断同一场地预约时间是否冲突
    public List<Placeappointment> queryappointment(Placeappointment placeappointment);

    //增加场地申请
    @Insert("insert into placeappointment values(#{userid},#{placeid},#{starttime},#{endtime},null,0)")
    public int orderplace(Placeappointment placeappointment);

    //sql语句请看mapper文件夹中xml文件
    //两个功能，一管理员进行审核，judge为1表示院级审核通过，judge为2表示校级审核通过，二，用户归还场地
    public int judgePlaceappoinment(Placeappointment placeappointment);

    //管理员拒绝申请，删除该申请
    @Delete("delete from placeappointment where userid=#{userid} and placeid=#{placeid} " +
            "and starttime=#{starttime} and endtime=#{endtime}")
    public int deletePlaceappointment(Placeappointment placeappointment);
}
